<?php

namespace App\Http\Requests\Store;

use App\Http\Requests\BaseRequest;

class SetStorePassRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id'         => 'required|integer|exists:stores,id,aid,' . auth()->id(),
            'store_pass' => 'required|string|min:6|max:18',
        ];
    }

    public function messages()
    {
        return [
            'store_pass.required' => '请填写密码',
            'store_pass.min'      => '密码不能少于6个字符',
            'store_pass.max'      => '密码不能超过18个字符',
        ];
    }
}
